<template>
    <div>
        <r-search :searchForm="searchForm" :searchHandle="searchHandle" :searchData="searchData" />
        <r-table :isPagination="true" :tableData="tableData" :tableCols="tableCols" :tablePage="tablePage" @refresh="init()"></r-table>
        <!-- <r-form :formRules="formRules" :formHandle="formHandle" :formData="formData" :formCols="formCols" ref="elForm" labelWidth="100px" dialogWidth="500px" :isHandle="true" /> -->
    </div>
</template>
<script>
export default {
    data() {
        return {
            searchData: {
                orderNo:'',
                nickName:'',
                state:'',
                etime:''
            },
            searchForm: [
                {
                    type: 'input',
                    prop: 'orderNo',
                    placeholder: '订单编号',
                    width: 150
                },
                {
                    type: 'input',
                    prop: 'nickName',
                    placeholder: '下单用户',
                    width: 150
                },
                {
                    type: 'select',
                    prop: 'state',
                    placeholder: '订单状态',
                    width: 150,
                    options: [
                        {
                            label: '已创建',
                            value: '0'
                        },
                        {
                            label: '待接单',
                            value: '1'
                        },
                        {
                            label: '待配送',
                            value: '2'
                        },
                        {
                            label: '已送达',
                            value: '3'
                        },
                        {
                            label: '已完成',
                            value: '4'
                        },
                        {
                            label: '已销毁',
                            value: '5'
                        },
                        {
                            label: '已取消',
                            value: '6'
                        },
                        {
                            label: '申请售后',
                            value: '7'
                        },
                        {
                            label: '已退款',
                            value: '8'
                        },
                        {
                            label: '不退款',
                            value: '9'
                        },
                        {
                            label: '已超时',
                            value: '10'
                        },
                    ]
                },
                {
                    type: 'date',
                    prop: 'etime',
                    placeholder: '提交时间',
                    width: 170,
                    options: [
                    ]
                },
            ],
            searchHandle: [
                {
                    label: '搜索',
                    type: 'success',
                    icon: 'el-icon-search',
                    handle: e => this.elFormSubmit()
                },
                {
                    label: '重置',
                    icon: 'el-icon-refresh-right',
                    handle: e => this.searchFromReset()
                }
            ],
            tableData: [
                
            ],
            tableCols: [
                {
                    label: '订单编号',
                    prop: 'orderNo',
                    // theme: e => e.status ? 'primary' : 'danger', type: "tag",
                },
                {
                    label: '提交时间',
                    prop: 'createdTime',
                },
                {
                    label: '用户名',
                    prop: 'userName',
                },
                {
                    label: '手机号码',
                    prop: 'phone'
                },
                {
                    label: '充值金额',
                    prop: 'topupMoney'
                },
                {
                    label: '支付方式',
                    prop: 'payType',
                    formatter: e => e.payType == 1 ? "未知" : e.payType == 2 ? '微信公众号支付' : e.payType == 3 ? '微信公众号免密支付' : e.payType == 4 ? '微信人脸识别支付' : e.payType == 5 ? 'IC卡支付' : e.payType == 6 ? '支付宝支付' : e.payType == 7 ? '支付宝免密支付' : ''
                },
                {
                    label: '订单状态',
                    prop: 'state',
                    formatter: e => e.state == 26 ? '充值失败' : e.state == 27 ? '充值成功' : '',
                }
            ],
            tablePage: { limit: 10, page: 1, total: 0 },

        };
    },
    components: {},
    computed: {},
    mounted () {
      this.init()  
    },
    methods: {
        async init() {
            let param = { ...this.searchData, ...this.tablePage }
            let res = await this.api.blancelist(param)
            if(res){
                this.tablePage.total=res.data.total
                this.tableData=res.data.list
            }
        },
        //查询
        elFormSubmit() {
            
        },
        goDetail() {
            this.$router.push('/saleServe-Detail')
        }
    }
};
</script>
<style scoped lang='scss'>
.el-icon-search {
  margin-right: 10px;
}
</style>